﻿using System;
using System.Reflection;
using MugenInjection.Logging.Interface;

namespace MugenInjection.Logging.Infrastructure
{
    internal class DefaultLoggerContext : ILoggerContext
    {
        #region Constructor

        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultLoggerContext"/> class.
        /// </summary>
        public DefaultLoggerContext(ILogger logger, MethodBase callingMethod, string logMessage,
                                    LogLevel logLevel,
                                    object[] args, Exception exception)
        {
            CallingMethod = callingMethod;
            Logger = logger;
            LogMessage = logMessage;
            LogLevel = logLevel;
            Args = args;
            Exception = exception;
        }

        #endregion

        #region Implementation of ILoggerContext

        /// <summary>
        /// Gets the <see cref="ILogger"/> created context.
        /// </summary>
        public ILogger Logger { get; private set; }

        /// <summary>
        /// Gets the method of calling log.
        /// </summary>
        public MethodBase CallingMethod { get; private set; }

        /// <summary>
        /// Gets the level of the log.
        /// </summary>
        public LogLevel LogLevel { get; private set; }

        /// <summary>
        /// Gets the message of the log.
        /// </summary>
        public string LogMessage { get; set; }

        /// <summary>
        /// Gets the arguments of the log. (Can be null).
        /// </summary>
        public object[] Args { get; set; }

        /// <summary>
        /// Gets the exception of the log. (Can be null).
        /// </summary>
        public Exception Exception { get; private set; }

        #endregion
    }
}